package com.lhc.bean.aware;

import org.springframework.context.annotation.ImportAware;
import org.springframework.core.annotation.MergedAnnotations;
import org.springframework.core.type.AnnotationMetadata;

/**
 * @author LuHuanCheng
 * 类说明：这个类没有加@Component注解，但是又想让它实例化，再另外一个bean引入它
 */
public class ImportAwareBean implements ImportAware {
    @Override
    public void setImportMetadata(AnnotationMetadata importMetadata) {
        //这个方法就是拿到注解的值
        MergedAnnotations annotations = importMetadata.getAnnotations();
    }
}